package com.xauto.pioneer.appuser.adapter;

import android.app.Activity;
import android.view.View;
import android.widget.TextView;

import com.xauto.pioneer.appuser.R;
import com.xauto.pioneer.appuser.model.TransactionInfo;

/**
 * Created by Lemon on 2015/12/11.
 * Desc:优惠券列表 适配器
 */
public class TransactionAdapter extends AbsAdapter<TransactionInfo> {
    private boolean is_used_tag;
    private boolean isFromOrder;
    private int selectPosition = -1;

    public void setFromOrder(boolean fromOrder) {
        isFromOrder = fromOrder;
    }

    public void setSelectPosition(int selectPosition) {
        this.selectPosition = selectPosition;
    }
    public void setIs_used_tag(boolean is_used_tag) {
        this.is_used_tag = is_used_tag;
    }

    public TransactionAdapter(Activity context, int layout) {
        super(context, layout);
    }

    @Override
    public ViewHolder<TransactionInfo> getHolder() {
        return new TemplateViewHolder();
    }


    private class TemplateViewHolder implements ViewHolder<TransactionInfo> {
        private TextView tvTransactionDate;
        private TextView tvTransactionDes;
        private TextView tvTransactionMoney;

        @Override
        public void initViews(View v, int position) {
            tvTransactionDate = (TextView) v.findViewById(R.id.tvTransactionDate);
            tvTransactionDes = (TextView) v.findViewById(R.id.tvTransactionDes);
            tvTransactionMoney = (TextView) v.findViewById(R.id.tvTransactionMoney);
        }

        @Override
        public void updateData(TransactionInfo transactionInfo, int position) {
            tvTransactionDate.setText(transactionInfo.member_amount_transaction_date_format);
            tvTransactionDes.setText(transactionInfo.member_amount_transaction_name);
            tvTransactionMoney.setText("￥"+transactionInfo.amount_format+"元");
        }

        @Override
        public void doOthers(TransactionInfo transactionInfo, int position) {

        }
    }
}
